# Maintainer: Jürgen Pfeifer <juergen@familiepfeifer.de>

_realname=gprbuild-gpl
pkgbase=mingw-w64-${_realname}
pkgname=${MINGW_PACKAGE_PREFIX}-${_realname}
pkgrel=1
pkgver=2014
pkgdesc="Software tool designed to help automate the construction of multi-language systems"
arch=('any')
provides=("${MINGW_PACKAGE_PREFIX}-${_realname%-*}")
license=('GPL3')
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc-ada"
             #"${MINGW_PACKAGE_PREFIX}-xmlada"
            )
depends=("${MINGW_PACKAGE_PREFIX}-gcc-ada"
        # "${MINGW_PACKAGE_PREFIX}-xmlada"
         )
url="http://www.adacore.com/gnatpro/toolsuite/gprbuild/"
source=("http://downloads.dragonlace.net/src/${_realname}-${pkgver}-src.tar.gz"
        "0001_gnat_vmsp.patch")
sha256sums=('3c8986ff5f83cc0d3ee69f6e71d9f69a7eb1a7e2656493c829b18fb55c4ad5ac'
            'a05e637de1ef87d3cf64bb179594a6707fae650120adeee8ae0310622b2ced02')

prepare()
{
  cd ${srcdir}/${_realname}-${pkgver}-src

  patch -p1 -i "${srcdir}/0001_gnat_vmsp.patch"
}

build() {
  cd ${srcdir}/${_realname}-${pkgver}-src
  if [ -f Makefile ]; then
    make distclean
  fi
  ./configure \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --prefix=${MINGW_PREFIX}

    make
}

package() {
  cd ${srcdir}/${_realname}-${pkgver}-src
  make prefix="${pkgdir}${MINGW_PREFIX}" INSTALL=cp install

  # Copy License Files
  mkdir -p ${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}
  cp -pf COPYING* ${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/
}
